/*!
 * @Author: CPS
 * @email: 373704015@qq.com
 * @Date: 2020-09-17 17:51:59
 * @Last Modified by: CPS
 * @Last Modified time: 2020-09-20 23:58:18
 * @Projectname Electron-fileWatcher
 * @file_path "C:\Users\SSD_WIN10\AppData\Roaming\Sublime Text 3\Packages\testt\stylusBeautify\html2pug.js"
 * @Filename "html2pug.js"
 */
'use strict'
const html2pug = require("html2pug")
const defaultOptions = require('./html2pug.defaultOptions.js')

// 判断环境
if (process.mainModule.filename === __filename) {
  let test = `
  <div class="about">
    <h1>This is an about page</h1>
  </div>
`
  console.log(html2pug(test, defaultOptions))
}

module.exports = (tar) => {
  let res
  try {
    res = html2pug(tar, defaultOptions)
  } catch (e) {
    // statements
    console.log(e)
    res = e
  }
  return res
}
